import GxBase from "@/_gx/_Base/GxBase";

import { tokenStore } from "@/stores/tokenStore";
class GxExt extends GxBase {
    /**
     * 获取是否有权限
     * @param perID
     * @returns
     */
    public static HasPermission(perID: number): boolean {
        let store = tokenStore();
        if (Gx.IsEmpty(store.me) || Gx.IsEmpty(store.me.permissions) || store.me.permissions.length == 0) {
            return false;
        }

        let findItem = store.me.permissions.find((x) => x.perID == perID);
        if (Gx.IsEmpty(findItem)) {
            return false;
        } else {
            return findItem.isPermission;
        }
    }
}

export default GxExt;
